local storyboard = require( "storyboard" )
local scene = storyboard.newScene()

local MenuUtils = require 'scripts.utils.MenuUtils'
local menuUtils = MenuUtils.new()

function scene:createLevelButtons()
   local group=self.view

   local background = display.newImageRect( "resources/sprites/menuBG.jpg", X, Y )
   background.x = X*0.5
   background.y = Y*0.5
   group:insert( background )

   local playBtn = menuUtils:createButton(X*0.25, Y*0.6, "Level 1", function ()
      storyboard.gotoScene("scripts.scenes.introGame",{effect = "fade",time = 100})
      return true
   end)
   group:insert( playBtn )

   local playBtn = menuUtils:createButton(X*0.25, Y*0.6+Y*0.15, "Level 2", function ()
      LEVEL = 3
      storyboard.gotoScene("scripts.scenes.GridTestScene",{effect = "fade",time = 100})
      return true
   end)
   group:insert( playBtn )
end

function scene:createScene(event)
   logger:gameEvent("Create Level Selection Scene")
   storyboard.removeAll()
   scene:createLevelButtons()
end

function scene:enterScene(event)
   logger:gameEvent("Entering Level Selection Scene")
end

function scene:exitScene(event)
   logger:gameEvent("exit Level Selection Scene")
   -- display.remove(title)
end

function scene:destroyScene(event)
   logger:gameEvent("destroy Level Selection Scene")
end

scene:addEventListener("createScene",scene)
scene:addEventListener("enterScene",scene)
scene:addEventListener("exitScene",scene)
scene:addEventListener("destroyScene", scene)

return scene

